<?php
/**
 * theme : default
 * description : fullwidth-content
 * author : Gmax
 */

//déclaration des variables pour l'affichage de la page
$posts = $this->getPublications();
$category = $this->getCategory();
$article = ($this->getTargetType()==='page'||$this->getTargetType()==='publication')?$this->getTarget():null;
if($this->getTarget()!==null && $this->getTarget()->haveMedia()){
    $topImage = $this->getTarget()->getMedia();
}elseif($category!==null && $category->haveMedia()){
    $topImage = $category->getMedia();
}
?>
<?php if(isset($topImage)&&$topImage!==null&&$topImage->getHeight()>0): ?>
<div class="top-image">
    <img class="banniere" src="<?php echo $topImage->getUrl(); ?>" width="<?php echo $topImage->getWidth(); ?>" alt="<?php echo $topImage->getLegende(); ?>" title="<?php echo $topImage->getTitle(); ?>"/>
</div>
<?php else: ?>
<div class="gabarit-top-image">
    &nbsp;
</div>
<?php endif; ?>
<div class="container hidden">
    <?php echo $this->getBreadcrumb('|'); ?>
</div>
<div class="separateur">&nbsp;</div>
<div id="content" class="container">
     <div class="sixteen columns">
        <h1 class="title"><?php echo ($article!==null)?$article->getTitle():$category->getTitle(); ?></h1>
        <?php if(count($posts)>0): ?>
        <?php foreach( $posts as $oPost ): ?>
        <?php $post = $oPost->getDatas(); ?>
        <article id="post_<?php echo $post['id']; ?>"><div class="article">
            <?php if($article===null&&$category!==null&&$category->getTitle()!==$post['title']): ?><h2><a href="<?php echo $post['url']; ?>" title=""><?php echo $post['title']; ?></a></h2><?php endif; ?>
            <div class="post-content">
            <?php if(count($posts)>1): ?>
                <?php if(strlen($oPost->getSummary(false,1000))<700): ?>
                    <?php echo $post['content']; ?>
                <?php else: ?>
                    <?php echo $oPost->getSummary(false,1000); ?>...
                    <p style="margin: 12px 5px;"><a href="<?php echo $oPost->getUrl(); ?>" class="suite_article">> Lire la suite</a></p>
                <?php endif; ?>
            <?php else: ?>
                <?php echo $post['content']; ?>
            <?php endif; ?>
            </div>
            <div class="clear">&nbsp;</div>
        </div></article>
        <?php endforeach; ?>
        <?php else: ?>
        <article id="nopost"><div class="article">
            <div class="post-content">
                Cette rubrique est actuellement en construction.
            </div>
        </div></article>
        <?php endif; ?>
    </div>
</div>